def fib_by_recursion(num):
    if num == 1:
        return 1
    elif num == 2:
        return 1
    elif num > 2:
        return fib_by_recursion(num - 1) + fib_by_recursion(num - 2)
    else:
        print('False')


def fib_by_list(num):
    if num == 1:
        return [1]
    elif num == 2:
        return [1, 1]
    lst = [1, 1]
    for i in range(2, num):
        # 最后两项相加并添加到列表
        lst.append(lst[-2] + lst[-1])
    return lst


def fib_by_for_loop(num):
    a, b = 1, 1
    lst = []
    for i in range(num):
        lst.append(a)
        a, b = b, b + a
    return lst


if __name__ == '__main__':
    print([fib_by_recursion(i) for i in range(1, 11)])
    print(fib_by_list(10))
    print(fib_by_for_loop(10))
